package ljl.codetop;

import commons.TreeNode;

import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;

public class _94_inorder {

    static class tryout {
        public List<Integer> inorderTraversal(TreeNode root) {
            LinkedList<TreeNode> q = new LinkedList<>();
            List<Integer> res = new ArrayList<>();
            while (!q.isEmpty() || root != null) {
                while (root != null) {
                    q.push(root);
                    root = root.left;
                }
                root = q.pop();
                res.add(root.val);
                root = root.right;
            }
            return res;
        }
    }
}
